<?php
defined('IN_YuLin') || exit('NO PERMIT!');
$table = Table('article');
//添加或编辑
$id = intval($_GET['id']);
$id and $arr = $db->getrow('SELECT * FROM '.$table.' WHERE id = '.$id);
if(IS_POST){
    $id = intval($_POST['id']);
    $data['cid']		=   intval($_POST['cid']);
    $data['title']	=   NoBadStr($_POST['title']);
    $data['content']	=   NoBadStr($_POST['content']);
    $data['dateline']	=   time();
    if($id){
        $res = $db->exec('UPDATE '.$table.' SET '.CreateUpdateSql($data).' WHERE id = '.$id);
    }else{
        $res = $db->exec('INSERT INTO '.$table.CreateInsertSql($data));
    }
    ShowMsg('操作成功',U($m.'/about'));
}
$tpl->display($m.'/about_add');
?>